import { _decorator, Component, Node, Widget } from 'cc';
import { _platform, _player, _resource } from '../Main';
const { ccclass, property } = _decorator;

@ccclass('BaseScene')
export class BaseScene extends Component {

    sceneName: string = '场景'

    start() {
        this.init()
    }

    /** 初始化 */
    init() {
        _resource.fitNode(this.node)
        _player.initAduios()
        this.refreshUI()
    }

    refreshUI() {
        let sysInfo = _platform.platform.systemInfo
        if (!sysInfo || !sysInfo.safeArea) {
            return
        }
        let top: Node = this.node.getChildByName('UI').getChildByName('Top')
        let wt: Widget = top.getComponent(Widget)
        let wbottom: number = sysInfo.safeArea.height * sysInfo.pixelRatio - 50
        wt.bottom = wbottom
    }
}


